<?php
session_start();

include_once("../../Misc.php");
include_once("../../helpers/CHtml.php");
include_once("../../helpers/CJavascript.php");
include_once("../../helpers/Composer.php");
include_once("../../classCol/classOracleDb.php");
include_once("../models/fetchers.php");

$srcDb = "MST_GL_ACC";

$GHtml      = new CGHtml;
$GJs        = new CGJavascript;
$Misc       = new Misc;

$CLFetchers = new CLFetchers;

$Db = new oracleDb;
$Db->init($_SESSION["ORCL"],
          $_SESSION["OPASS"],
          $_SESSION["SID"],
          _NO_COMMENT);

if($Db->connect()){

  /**
   * if isList
   * means get list
   * else
   * means get name
   */
  if($_POST["isList"]){

    $CLFetchers->fetchLstGlAcc($Db,
                               $srcDb,
                               $nGlAcc,
                               $lstGlAcc);

    $GHtml->initDropDownContent($lstGlAcc["GL_ACC_NAME"],
                                $_POST["glAcc"],
                                $retContent);

    echo  $retContent;
  }else{

    $CLFetchers->fetchGlAccCode($Db,
                                $_POST["glAccName"],
                                $srcDb,
                                $glAccCode);

    echo  $glAccCode;
  }

  $Db->dc();
}else{

  $Misc->usrDieJs(_DB_CONN_ERROR);
}

?>
